package cn.iocoder.yudao.module.english.dal.mysql.student;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.english.controller.admin.student.vo.StudentPageReqVO;
import cn.iocoder.yudao.module.english.dal.dataobject.student.StudentDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 学生 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface StudentMapper extends BaseMapperX<StudentDO> {

    default PageResult<StudentDO> selectPage(StudentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StudentDO>()
                .likeIfPresent(StudentDO::getStudentName, reqVO.getStudentName())
                .eqIfPresent(StudentDO::getAge, reqVO.getAge())
                .eqIfPresent(StudentDO::getMobilePhone, reqVO.getMobilePhone())
                .likeIfPresent(StudentDO::getNickname, reqVO.getNickname())
                .eqIfPresent(StudentDO::getStatus, reqVO.getStatus())
                .eqIfPresent(StudentDO::getDeadline, reqVO.getDeadline())
                .eqIfPresent(StudentDO::getClassId, reqVO.getClassId())
                .eqIfPresent(StudentDO::getGoldCoins, reqVO.getGoldCoins())
                .eqIfPresent(StudentDO::getLoginPassword, reqVO.getLoginPassword())
                .likeIfPresent(StudentDO::getParentName, reqVO.getParentName())
                .eqIfPresent(StudentDO::getHomeAddress, reqVO.getHomeAddress())
                .eqIfPresent(StudentDO::getParentContact, reqVO.getParentContact())
                .eqIfPresent(StudentDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(StudentDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StudentDO::getCreateTime));
    }

}